<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
                <el-form-item label="用户信息">
                    <el-input
                        class="w-[280px]"
                        v-model="queryParams.keyword"
                        placeholder="昵称"
                        clearable
                      @keyup.enter="resetPage"
                    />
					  
                </el-form-item>
          <!--      <el-form-item label="注册时间">
                    <daterange-picker
                        v-model:startTime="queryParams.create_time_start"
                        v-model:endTime="queryParams.create_time_end"
                    />
                </el-form-item> -->
             <!--   <el-form-item label="注册来源">
                    <el-select class="w-[280px]" v-model="queryParams.channel">
                        <el-option
                            v-for="(item, key) in ClientMap"
                            :key="key"
                            :label="item"
                            :value="key"
                        />
                    </el-select>
                </el-form-item> -->
              <!-- <div @click="xx">12354</div> -->
		
               <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
					<upload
					    @change="onChange"
					    @success="onSuccess"
					    @error="onError"
					    :show-progress="true"
						:urldizhi="biaoge"
					>
					    <el-button type="primary" class="shui-text1">上传表格</el-button>
					</upload>
                <!--    <export-data
                        class="ml-2.5"
                        :fetch-fun="getUserList"
                        :params="queryParams"
                        :page-size="pager.size"
                    /> -->
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-table size="large" v-loading="pager.loading" :data="pager.lists">
              <!--  <el-table-column label="用户编号" prop="sn" min-width="120" />
                <el-table-column label="头像" min-width="100">
                    <template #default="{ row }">
                        <el-avatar :src="row.avatar" :size="50" />
                    </template>
                </el-table-column> -->
                <el-table-column label="昵称" prop="nickname" min-width="100" />
                <el-table-column label="真实姓名" prop="real_name" min-width="100" />
                <el-table-column label="身份证号" prop="card" min-width="100" />
				<!-- <el-table-column label="配偶姓名" prop="partnername" min-width="100" /> -->
				<!-- <el-table-column label="配偶身份证号" prop="partnersunm" min-width="100" /> -->
                <el-table-column label="账号" prop="account" min-width="120" />
                <el-table-column label="手机号码" prop="mobile" min-width="100" />
				<el-table-column label="性别" min-width="100">
				    <template #default="{ row }">
				       <div v-if="row.sex==1">男</div>
				       <div v-if="row.sex==2">女</div>
				    </template>
				</el-table-column>
				
                <!-- <el-table-column label="登记地址" prop="organ" min-width="120" /> -->
                <el-table-column label="操作" width="120" fixed="right">
                    <template #default="{ row }">
                        <el-button v-perms="['user.user/detail']" type="primary" link>
                            <router-link
                                :to="{
                                    path: getRoutePath('user.user/detail'),
                                    query: {
                                        id: row.id
                                    }
                                }"
                            >
                                详情
                            </router-link>
							<div class="shanchu" @click="delFn(row.id)">删除</div>
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="flex justify-end mt-4">
                <pagination v-model="pager" @change="getLists"/>
				<!-- <pagination 
				v-model:current-page="currentPage4"
				v-model:page-size="pageSize4" 
				@change="getLists" /> -->
            </div>
        </el-card>
    </div>
</template>
<script lang="ts" setup name="consumerLists">
import { usePaging } from '@/hooks/userlist'
import { getRoutePath } from '@/router'
import { getUserList,getlpd,dele } from '@/api/consumer'
import { ClientMap } from '@/enums/appEnums'
import Upload from '@/views/consumer/lists/fileqq.vue'




const queryParams = reactive({
    keyword: '',
    channel: '',
    create_time_start: '',
    create_time_end: ''
})

const { pager, getLists, resetPage, resetParams } = usePaging({
	
    fetchFun: getUserList,
    params: queryParams
})
// onActivated(() => {
//     getLists()
// 	// console.log(pager.lists,'pager.lists');
// })
onMounted(() => {
    getLists()
	// console.log(pager,'pager.lists');
})
const biaoge='/user.user/daoru'
const onChange = (file: any) => {
    console.log('上传文件的状态发生改变', file)
}

const onSuccess = (file: any) => {
    console.log('上传文件成功', file)
	location.reload()
}

const onError = (file: any) => {
    console.log('上传文件失败', file)
}

const delFn=async(id:any)=>{
	console.log(id,"id");
	let data=await dele({id:id})
	location.reload()
}
</script>
<style>
	.shanchu{
		margin-left: 10px;
	}
	.shui-text1{
		margin-left: 10px;
	}
</style>
